<?php
class Employee extends DataObject{
    static $db = array(
		'Title'		    => 'Varchar(255)',
        'Content'       => 'HTMLText',        
    );
    
    static $has_one = array(        
		'Image'			=> 'Image',
		'EmployeePage'	=> 'EmployeePage',
    );
	
    function getCMSFields_forPopup() {		
        $fields = new FieldSet();        
        
        $fields->push(new TextField('Title', 'Title'));         
		$fields->push(new ImageField('Image', 'Image (Recommended size: 136 x 112)'));
           
        $fields->push(new SimpleTinyMCEField('Content', 'Content', null, 20));        
        
        return $fields;
    }

    public function Thumbnail() {
		$image = null;
		
		if($this->Image()){
			$image = $this->Image()->CroppedImage(50, 50);		 
		}
		
		return $image;
	}
    
    function IntroText(){
        $intro = new Text();
        $intro->setValue($this->Content);
        
        return $intro->LimitWordCount(10);
    }
}